package com.innovation.chengzhangriji.http;

import com.google.gson.annotations.SerializedName;
import com.innovation.library.http.InnovationRequestBody;

public class BabyUpdateRequest extends BaseTokenRequest{

    public static final String PATH = BaseRequest.PATH + "api/update_baby_info";

    private int id;

    private long updateTime;

    private Change[] changes;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(long updateTime) {
        this.updateTime = updateTime;
    }

    public Change[] getChanges() {
        return changes;
    }

    public void setChanges(Change[] changes) {
        this.changes = changes;
    }

    @Override
    protected InnovationRequestBody getInnovationRequestBody() {
        BabyUpdateRequestBody body = new BabyUpdateRequestBody();
        body.setPhone(getPhone());
        body.setToken(getToken());
        body.setId(id);
        body.setUpdateTime(updateTime);
        body.setChanges(changes);
        return body;
    }

    private class BabyUpdateRequestBody extends BaseTokenRequestBody {

        @SerializedName("BabyID")
        private int id;

        @SerializedName("LastChangeTS")
        private long updateTime;

        @SerializedName("Changes")
        private Change[] changes;

        private BabyUpdateRequestBody() {
            setSv(BaseRequestConfig.SV_BABY_UPDATE);
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public long getUpdateTime() {
            return updateTime;
        }

        public void setUpdateTime(long updateTime) {
            this.updateTime = updateTime;
        }

        public Change[] getChanges() {
            return changes;
        }

        public void setChanges(Change[] changes) {
            this.changes = changes;
        }
    }
}
